package com.qianfeng.listviewdemo;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;

public class Main2Activity extends AppCompatActivity {

    private int po;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main2);
        Intent intent = getIntent();//获取启动这个 activity 的意图
        po = intent.getIntExtra("po", -1);
    }

    public void onClick(View view) {
        String s = ((EditText) findViewById(R.id.et)).getText().toString();
        Intent intent = new Intent();
        intent.putExtra("po", po);
        intent.putExtra("data", s);
        setResult(Activity.RESULT_OK,intent);
        finish();
    }
}
